
function initLazyLoad(){
//	 $(window).scroll(myLazyLoad);
//	 $("div").lazyload({effect: 'fadeOut'});
	
	 $(".div").each(function(){
		 if ($(window).scrollTop() + $(window).height() >= $(this).offset().top) {
	            if(!$(this).attr('loaded')) {
	                //not in ajax.success due to multiple sroll events
	                $(this).attr('loaded', true);

	                //ajax goes here
	                alert($(this).attr('id'));
	                //by theory, this code still may be called several times
	            }
	        }
	 });
	
	 $(window).scroll(function() {
	        //check if your div is visible to user
	        // CODE ONLY CHECKS VISIBILITY FROM TOP OF THE PAGE
		 $(".div").each(function(){
			 var curNode = $(this)[0];
			 if ($(window).scrollTop() + $(window).height() >= curNode.offset().top) {
		            if(!curNode.attr('loaded')) {
		                //not in ajax.success due to multiple sroll events
		            	curNode.attr('loaded', true);

		                //ajax goes here
		                alert($(this).attr('id'));
		                //by theory, this code still may be called several times
		            }
		        }
		 });
		 
	        
	    });
}

//function myLazyLoad(){
//	alert();
//	 var wt = $(window).scrollTop();    //* top of the window
//	   var wb = wt + $(window).height();  //* bottom of the window
//
//	   $(".lazyload").each(function(){
//	      var ot = $(this).offset().top;  //* top of object (i.e. advertising div)
//	      var ob = ot + $(this).height(); //* bottom of object
//
//	      if(!$(this).attr("loaded") && wt<=ob && wb >= ot){
//	    	  alert("ee");
//	         
//	         $(this).attr("loaded",true);
//	      }
//	   });
//}